<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta content="text/html; charset=UTF-8" http-equiv="content-type" />
	<title>jqLeftClick Plugin Testcase</title>
	<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
	<script type="text/javascript" src="jqLeftClick.js"></script>
	<script type="text/javascript">
	//<![CDATA[
		
		/*
			In this test we check the basic functionality along with
			simple check for ability to attach to dynamically created objects.
			Initially there is only one <button> object in DOM with id of "button1".
			When it is pressed, a new <button> with id of "button2" is inserted into DOM.
			Leftclick event can be attached to button2 using .live() BEFORE document.ready state.
			The same event is attached to button1 using .bind() during document.ready state.
		*/
		
		$('#button2').live('leftclick', function(event){
			$('body').append('<p>You clicked button 2!</p>');
			if (console) console.log(event);
		});
		
		$(function(){
			$('#button1').bind('leftclick', function(event){
				if (!$('#button2').attr('id')) $('<button>').attr('id','button2').html('Button 2').appendTo('body');
				$('body').append('<p>You clicked button 1!</p>');
				if (console) console.log(event);
			});
		});
	//]]>
	</script>
	</head>
	<body>
		<button id="button1">Button 1</button>
	</body>
</html>